<template>
	<view class="top" :style="{ height: (titleHeight + statusBarHeight) + 'px' }">
		<view :style="{ 
			paddingTop: statusBarHeight + 'px', 
			height: titleHeight + 'px',
			lineHeight: titleHeight + 'px',
		}">
			<slot></slot>
		</view>
	</view>
	<up-gap :height="titleHeight + statusBarHeight"></up-gap>
</template>

<script>
	export default {
		data() {
			return {
				titleHeight: 0,
				statusBarHeight: 0,
				topSrc: 'https://qiniu.mageexiao.com/top.png',
			}
		},
		created() {
			let titleHeight = 0
			const { statusBarHeight, system } = uni.getSystemInfoSync()
			
			if (system.indexOf('Android') > 0) {
				titleHeight = 48
			} else {
				titleHeight = 44
			}
			
			this.titleHeight = titleHeight
			this.statusBarHeight = statusBarHeight
		},
		methods: {
			
		}
	}
</script>

<style lang="scss" scoped>
.top {
	position: fixed;
	left: 0;
	right: 0;
	z-index: 99;
	background-size: 100%;
	box-sizing: border-box;
	background-color: #f60000;
	
	view {
		color: #fff;
		padding-left: 30rpx;
		font-size: 32rpx;
	}
}
</style>
